<?php
/* SVN FILE: $Id: lil_blogs_log_plugin_controller.php 162 2009-10-14 19:48:36Z miha@nahtigal.com $ */
/**
 * Short description for lil_blogs_log_plugin_controller.php
 *
 * Long description for lil_blogs_log_plugin_controller.php
 *
 * PHP versions 4 and 5
 *
 * Copyright (c) 2009, Miha Nahtigal
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright     Copyright (c) 2009, Miha Nahtigal
 * @link          http://www.nahtigal.com/
 * @package       lil_blogs_log_plugin
 * @subpackage    lil_blogs_log_plugin
 * @since         v 1.0
 * @version       $Revision: 162 $
 * @modifiedby    $LastChangedBy: miha@nahtigal.com $
 * @lastmodified  $Date: 2009-10-14 19:48:36 +0000 (Wed, 14 Oct 2009) $
 * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
 */
App::import('Controller', 'LilBlogs.LilBlogsPlugin');
/**
 * LilBlogsLogPlugin class
 *
 * @uses          LilBlogsLogPluginController
 * @package       lil_blogs_log_plugin
 * @subpackage    lil_blogs_log_plugin
 */
class LilBlogsLogPluginController extends LilBlogsPluginController {
/**
 * initialize method
 *
 * This is a plugins initialization method
 *
 * @access public
 * @return void
 */
	function _initialize() {
		$this->attachHandler('after_construct_model', '_attachLoggableBehavior');
	}
/**
 * attachLoggableBehavior method
 *
 * This function attaches loggable behavior to Post model.
 *
 * @param mixed $model
 * @access public
 * @return void
 */
	function _attachLoggableBehavior($model) {
		if ($model->name == 'Post') {
			$settings = array(
				'userModel' => 'Author', 
				'userKey' => 'user_id', 
				'change' => 'serialize',
				'description_ids' => false,
				'classField' => 'class',
				'foreignKey' => 'foreign_id',
			);
			$model->Behaviors->attach('LilBlogsLog.LilLog', $settings);
		}
	}

}
?>